// 


function rangeDay (day1, day2) {
    const result = []
     const dayTimes = 24*60*60*1000
     const startTime = day1.getTime()
     const range = day2.getTime() - startTime
     let total = 0
     
     while (total <= range && range > 0) {
         result.push(new Date(startTime + total).toLocaleDateString().replace(/\//g, '-'))
         total += dayTimes
     }
    return result
 };
 rangeDay(new Date("2015-02-08"), new Date("2015-03-03"))



 function toDateList(startTime, endTime) {
    // 2019-1-1 这种格式在ios是不兼容的Invalid Date。
    let startTimeStamp = new Date(startTime.replace(/-/g, '/')).getTime(),
      endTimeStamp = new Date(endTime.replace(/-/g, '/')).getTime(),
      dateList = []

    if (startTimeStamp > endTimeStamp) {
      return false
    }

    while (startTimeStamp !== endTimeStamp) {
      startTimeStamp += 24 * 60 * 60 * 1000

      let date = new Date(startTimeStamp)
        .toLocaleDateString()
        .replace(/\//g, '-')

      dateList.push(date)
    }

    return dateList
  }
  console.log(toDateList('2015-2-8', '2015-3-9'))